/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DBHandling;

import Entity.Role;
import java.sql.ResultSet;
import java.util.Vector;

/**
 *
 * @author HINSKY
 */
public class RoleHandling {
    private DBUtil du;

    public RoleHandling() {
        du = new DBUtil();
    }
    
    public Vector<Role> getRoles() throws Exception {
        ResultSet rs = du.executeSQL("Select * from Roles");   //get all role in database
        
        Vector<Role> roles = new Vector<Role>();
        while (rs.next()) {
            Role r = new Role();
            r.setRoleID(rs.getString("roleID"));
            r.setRoleName(rs.getString("roleName"));
            
            roles.add(r);
        }
        du.closeConnection();
        return roles;
    }
}
